﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master"
    Inherits="System.Web.Mvc.ViewPage<Beeldbankmvc.ViewModels.SearchViewModel>" %>

<%@ Import Namespace="Beeldbankmvc.Code" %>
<%@ Import Namespace="Beeldbankmvc.Controllers" %>
<%@ Import Namespace="Beeldbankmvc.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">Foto's en video's zoeken</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script src="<%=AppHelper.getContent("~/Content/js/searchScripts.js") %>" type="text/javascript"></script>

    <div class="page-title">
        <h1>Foto's en video's zoeken</h1>
    </div>

    <%     
        string displayModeClass = Request.QueryString["displayMode"];
        if (string.IsNullOrEmpty(displayModeClass)) displayModeClass = "2";
        displayModeClass = "displayMode" + displayModeClass;
    %>

    <div class="page-content <%=displayModeClass %>" id="searchpage">
        <form method="get" action="" class="custom-search">
            <fieldset>

                <legend>Zoek opties voor mediaobjecten</legend>

                <label><%: Model.NumberOfResults %> resultaten gevonden voor:</label><br />
                <a tabindex="10" class="custom-help" href="/Miscellaneous/FAQ" title="Help" rel="#search1">
                    <img class="help-icon" src="<%= AppHelper.getContent("~/Content/images/help.gif")%>" alt="Help icon" /></a>
                <input tabindex="8" placeholder="Zoekterm" type="text" id="searchBox" name="SearchCriteria" value="<%:Request.QueryString["SearchCriteria"] %>" title="Geef een of meerdere zoektermen op, of zoek op nummer met IDxxx waarbij xxx het gezochte foto- of filenummer bevat." />
                <button tabindex="9" class="searchbutton" title="Geef een of meerdere zoektermen op, of zoek op nummer met IDxxx waarbij xxx het gezochte foto- of filenummer bevat." type="submit">Zoeken</button>

                <div class="showright">
                    <% if (String.IsNullOrEmpty(Request.QueryString["onlyMyItems"]) && (Roles.IsUserInRole("Beheerder") || Roles.IsUserInRole("Administrator") || Roles.IsUserInRole("EindRedacteur"))) { %>
                    <div class="showright-content"><input type="checkbox" id="onlyMyItems" name="onlyMyItems" value="true" /><label for="onlyMyItems">Mijn resultaten</label></div>
                    <% } else if (Roles.IsUserInRole("Beheerder") || Roles.IsUserInRole("Administrator") || Roles.IsUserInRole("EindRedacteur")) { %>
                    <div class="showright-content"><input type="checkbox" id="onlyMyItems" name="onlyMyItems" value="true" <% if (Convert.ToBoolean(Request.QueryString["onlyMyItems"])) {%>checked="checked" <%} %> /><label for="onlyMyItems">Mijn resultaten</label></div>
                    <% } %>
                    <% if (Model.currentUserEmail.ToLower().EndsWith("@rws.nl")) { %>
                    <div class="showright-content"><input type="checkbox" id="showInternalItems" name="showInternalItems" value="true"
                        <% if (Convert.ToBoolean(Request.QueryString["showInternalItems"])){%>checked="checked"<%} %> /><label for="showInternalItems">RWS intern</label></div>
                    <% } %>
                </div>

                <input type="hidden" id="typeAnaloog" name="typeAnaloog" value="<%=Request.QueryString["typeAnaloog"] %>" />
                <input type="hidden" id="typeDigitaal" name="typeDigitaal" value="<%=Request.QueryString["typeDigitaal"] %>" />
                <input type="hidden" id="typeVideoAnimation" name="typeVideoAnimation" value="<%=Request.QueryString["typeVideoAnimation"] %>" />
                <input type="hidden" id="RegioFacet" name="RegioFacet" value="<%=Request.QueryString["RegioFacet"] %>" />
                <input type="hidden" id="TechniekFacet" name="TechniekFacet" value="<%=Request.QueryString["TechniekFacet"] %>" />
                <input type="hidden" id="RiviergebiedFacet" name="RiviergebiedFacet" value="<%=Request.QueryString["RiviergebiedFacet"] %>" />
                <input type="hidden" id="ProjectFacet" name="ProjectFacet" value="<%=Request.QueryString["ProjectFacet"] %>" />
                <input type="hidden" id="collectionId" name="collectionId" value="<%=Request.QueryString["collectionId"] %>" />
                <input type="hidden" id="statusId" name="statusId" value="<%=Request.QueryString["statusId"] %>" />
                <input type="hidden" id="fromDate" name="fromDate" value="<%=Request.QueryString["fromDate"] %>" />
                <input type="hidden" id="toDate" name="toDate" value="<%=Request.QueryString["toDate"] %>" />

                <% if (Roles.IsUserInRole("redactieCDR"))
                   { %>
                <div class="resultCopy">
                    <a id="copy-button" href="#">Kopieer deze resultaatpagina</a>
                </div>
                <% } %>

                <div id="customMobileFacetToggle">Toon filters</div>
                <div id="facetContainer">

                    <div id="facetColumnType">
                        <div>
                            <label>Type</label>
                            <ul>
                                <% 
                                    int typeIndex = 0;
                                    bool hasTypeMoreLink = false;
                                    foreach (var TypeFacet in Model.TypeFacets)
                                    {
                                        bool typeAnaloog = false;
                                        bool typeDigitaal = false;
                                        bool typeVideoAnimation = false;
                                        bool typeMapIllustration = false;

                                        switch (TypeFacet.Id)
                                        {
                                            case 16:
                                                {
                                                    typeAnaloog = true;
                                                    break;
                                                }

                                            case 19:
                                                {
                                                    typeDigitaal = true;
                                                    break;
                                                }

                                            case 20:
                                                {
                                                    typeVideoAnimation = true;
                                                    break;
                                                }

                                            case 24:
                                                {
                                                    typeMapIllustration = true;
                                                    break;
                                                }
                                        }
                                %>
                                <li>
                                    <%:Html.ActionLink(TypeFacet.Name, "Index", "Search", new
                                    {
                                        SearchCriteria = Request.QueryString["SearchCriteria"],
                                        typeAnaloog = typeAnaloog,
                                        typeDigitaal = typeDigitaal,
                                        typeVideoAnimation = typeVideoAnimation,
                                        typeMapIllustration = typeMapIllustration,
                                        onlyMyItems = Request.QueryString["onlyMyItems"],
                                        OrderBy = Request.QueryString["OrderBy"],
                                        fromDateCheck = Request.QueryString["fromDateCheck"],
                                        fromDate = Request.QueryString["fromDate"],
                                        toDateCheck = Request.QueryString["toDateCheck"],
                                        toDate = Request.QueryString["toDate"],
                                        displayMode = Request.QueryString["displayMode"],
                                        collectionId = Request.QueryString["collectionId"],
                                        statusId = Request.QueryString["statusId"],
                                        showInternalItems = Request.QueryString["showInternalItems"],
                                        RegioFacet = Request.QueryString["RegioFacet"],
                                        TechniekFacet = Request.QueryString["TechniekFacet"],
                                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                                        ProjectFacet = Request.QueryString["ProjectFacet"]                     
                                        }, null)%>
                                </li>
                                <%
                                    if (typeIndex == 2 && Model.TypeFacets.Count() > 4) {
                                        hasTypeMoreLink = true;
                                %>
                               <li><a href="#" class="link1 customMeer">meer...</a></li>
                           </ul>
                           <div id="block1" class="facetMoreContainer">
                               <ul id="moreBlock1" class="facetMoreList">
                               <% } 
                                  typeIndex++;
                                  }
                               %>
                               </ul>
                           </div>
                           <% if (hasTypeMoreLink){ %>
                        </div>
                        <% } %>
                    </div>

                    <div id="facetColumnYear">
                        <div>
                            <label>Jaar</label>
                            <ol>
                                <% 
                                    int yearIndex = 0;
                                    bool hasYearMoreLink = false;
                                    foreach (var YearFacet in Model.YearFacets)
                                    {
                                        if (YearFacet.results != 1900)
                                        { 
                                %><li><%:Html.ActionLink(YearFacet.results.ToString(), "Index", "Search", new
                                    {
                                        SearchCriteria = Request.QueryString["SearchCriteria"],
                                        typeAnaloog = Request.QueryString["typeAnaloog"],
                                        typeDigitaal = Request.QueryString["typeDigitaal"],
                                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                                        onlyMyItems = Request.QueryString["onlyMyItems"],
                                        OrderBy = Request.QueryString["OrderBy"],
                                        fromDateCheck = Request.QueryString["fromDateCheck"],
                                        fromDate = "1-1-" + YearFacet.results,
                                        toDateCheck = Request.QueryString["toDateCheck"],
                                        toDate = "31-12-" + YearFacet.results,
                                        displayMode = Request.QueryString["displayMode"],
                                        collectionId = Request.QueryString["collectionId"],
                                        statusId = Request.QueryString["statusId"],
                                        showInternalItems = Request.QueryString["showInternalItems"],
                                        RegioFacet = Request.QueryString["RegioFacet"],
                                        TechniekFacet = Request.QueryString["TechniekFacet"],
                                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                                        ProjectFacet = Request.QueryString["ProjectFacet"]                     
                                        }, null)%></li>
                                <%
                                    if (yearIndex == 2 && Model.YearFacets.Count() > 4)
                                    {
                                        hasYearMoreLink = true;
                                %>
                                <li><a href="#" class="link5 customMeer">meer...</a></li>
                            </ol>
                            <div id="block5" class="facetMoreContainerScroll">
                                <ol id="moreBlock5" class="facetMoreList">
                                <% }
                                       yearIndex++;
                                       }
                                   }
                                %>
                                </ol>
                            </div>
                            <%if (hasYearMoreLink)
                              {  %>
                        </div>
                        <% }%>
                    </div>

                    <div id="facetColumnRegio">
                        <div>
                            <label>Regio</label>
                            <ul>
                                <% 
                                    int regioIndex = 0;
                                    bool hasRegioMoreLink = false;
                                    foreach (var RegioFacet in Model.RegioFacets)
                                    {
                                %><li><%:Html.ActionLink(RegioFacet.Regio, "Index", "Search", new
                                    {
                                        SearchCriteria = Request.QueryString["SearchCriteria"],
                                        typeAnaloog = Request.QueryString["typeAnaloog"],
                                        typeDigitaal = Request.QueryString["typeDigitaal"],
                                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                                        onlyMyItems = Request.QueryString["onlyMyItems"],
                                        OrderBy = Request.QueryString["OrderBy"],
                                        fromDateCheck = Request.QueryString["fromDateCheck"],
                                        fromDate = Request.QueryString["fromDate"],
                                        toDateCheck = Request.QueryString["toDateCheck"],
                                        toDate = Request.QueryString["toDate"],
                                        displayMode = Request.QueryString["displayMode"],
                                        collectionId = Request.QueryString["collectionId"],
                                        statusId = Request.QueryString["statusId"],
                                        showInternalItems = Request.QueryString["showInternalItems"],
                                        RegioFacet = RegioFacet.Id,
                                        TechniekFacet = Request.QueryString["TechniekFacet"],
                                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                                        ProjectFacet = Request.QueryString["ProjectFacet"]
                                        }, null)%></li>
                                <%
                                        if (regioIndex == 2 && Model.RegioFacets.Count() > 4)
                                        {
                                            hasRegioMoreLink = true;
                                %>
                                <li><a href="#" class="link6 customMeer">meer...</a></li>
                            </ul>
                            <div id="block6" class="facetMoreContainer">
                                <ul id="moreBlock6" class="facetMoreList">
                                    <%
                                   }
                                   regioIndex++;
                                                    }
                                    %>
                                </ul>
                            </div>
                            <%if (hasRegioMoreLink)
                              {  %>
                        </div>
                        <% }%>
                    </div>

                    <% if (ConfigurationManager.AppSettings["publicationName"].Equals("RWS") || ConfigurationManager.AppSettings["publicationName"].Equals("MEDIASERVICE")) { %>
                    <div id="facetColumnThema">
                        <div>
                            <label>Thema</label>
                            <ul>
                                <% 
                           int themaIndex = 0;
                           bool hasThemaMoreLink = false;
                           foreach (var ThemaFacet in Model.ThemaFacets)
                           {
                                %><li><%:Html.ActionLink(ThemaFacet.Name, "Index", "Search", new
                            {
                                SearchCriteria = Request.QueryString["SearchCriteria"],
                                typeAnaloog = Request.QueryString["typeAnaloog"],
                                typeDigitaal = Request.QueryString["typeDigitaal"],
                                typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                                typeMapIllustration = Request.QueryString["typeMapIllustration"],
                                onlyMyItems = Request.QueryString["onlyMyItems"],
                                OrderBy = Request.QueryString["OrderBy"],
                                fromDateCheck = Request.QueryString["fromDateCheck"],
                                fromDate = Request.QueryString["fromDate"],
                                toDateCheck = Request.QueryString["toDateCheck"],
                                toDate = Request.QueryString["toDate"],
                                displayMode = Request.QueryString["displayMode"],
                                collectionId = ThemaFacet.Id,
                                statusId = Request.QueryString["statusId"],
                                showInternalItems = Request.QueryString["showInternalItems"],
                                RegioFacet = Request.QueryString["RegioFacet"],
                                TechniekFacet = Request.QueryString["TechniekFacet"],
                                RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                                ProjectFacet = Request.QueryString["ProjectFacet"]
                                }, null)%></li>
                                <%
                                       if (themaIndex == 2 && Model.ThemaFacets.Count() > 4)
                                       {
                                           hasThemaMoreLink = true;
                                                    %>
                                                    <li><a href="#" class="link7 customMeer">meer...</a></li>
                                                </ul>
                                                <div id="block7" class="facetMoreContainerScrollWide">
                                                    <ul id="moreBlock7" class="facetMoreList">
                                                        <%
                                       }
                                       themaIndex++;
                                   }
                                    %>
                                </ul>
                            </div>
                            <%if (hasThemaMoreLink)
                              {  %>
                        </div>
                        <% }%>
                    </div>
                    <% }
                       else
                       {  %>

                         <%--  Onderstaande is voor RVDR en is obsolete; RVDR heeft nu zijn eigen project. De hele conditional kan als het goed is worden verijderd. Dit zou dan gelden voor alle soortgelijke conditionals is dit project.
                             
                             
                             <div id="facetColumnTechniek">
                        <div>
                            <label>Techniek</label>
                            <ul>

                                <% 
                           int techniekIndex = 0;
                           bool hasTechniekMoreLink = false;
                           foreach (var TechniekFacet in Model.TechniekFacets)
                           {
                                %><li><%:Html.ActionLink(TechniekFacet.Techniek, "Index", "Search", new
                    {
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = TechniekFacet.Id,
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"]
                    }, null)%></li>
                                <%
                   if (techniekIndex == 2 && Model.TechniekFacets.Count() > 4)
                   {
                       hasTechniekMoreLink = true;
                                %>
                                <li><a href="#" class="link2">meer..</a></li>
                            </ul>
                            <div id="block2" class="facetMoreContainer">
                                <ul id="moreBlock2" class="facetMoreList">
                                    <%
                  }
                  techniekIndex++;
               }
                                    %>
                                </ul>
                            </div>
                            <%if (hasTechniekMoreLink)
                              {  %>
                        </div>
                        <!-- test -->
                        <% }%>
                    </div>


                    <div id="facetColumnRivierGebied">
                        <div>
                            <label>Riviergebied</label>
                            <ul>


                                <% 
            
                              int rivierGebiedIndex = 0;
                              bool hasRivierGebiedMoreLink = false;
                              foreach (var RivierGebiedFacet in Model.RivierGebiedFacets)
                              {
                                %><li><%:Html.ActionLink(RivierGebiedFacet.Riviergebied, "Index", "Search", new
                    {
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = RivierGebiedFacet.Id,
                        ProjectFacet = Request.QueryString["ProjectFacet"]
                    }, null)%></li>
                                <%
                                  if (rivierGebiedIndex == 2 && Model.RivierGebiedFacets.Count() > 4)
                                  {
                                      hasRivierGebiedMoreLink = true;
                                %>
                                <li><a href="#" class="link3">meer..</a></li>
                            </ul>
                            <div id="block3" class="facetMoreContainer">
                                <ul id="moreBlock3" class="facetMoreList">

                                    <%
                  }
                  rivierGebiedIndex++;
                              }
                                    %>
                                </ul>
                            </div>
                            <%if (hasRivierGebiedMoreLink)
                              {  %>
                        </div>
                        <% }%>
                    </div>

                    <div id="facetColumnProject">
                        <div>
                            <label>Project</label>
                            <ul>



                                <% 
                              int projectIndex = 0;
                              bool hasProjectMoreLink = false;
                              foreach (var ProjectFacet in Model.ProjectFacets)
                              {
                                %><li><%:Html.ActionLink(ProjectFacet.Project, "Index", "Search", new
                    {
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = ProjectFacet.Id
                    }, null)%></li>
                                <%
                                  if (projectIndex == 2 && Model.ProjectFacets.Count() > 4)
                                  {
                                      hasProjectMoreLink = true;
                                %>
                                <li><a href="#" class="link4">meer..</a></li>
                            </ul>
                            <div id="block4" class="facetMoreContainer">
                                <ul id="moreBlock4" class="facetMoreList">
                                    <%
                  }
                  projectIndex++;
                              }
                                    %>
                                </ul>
                            </div>
                            <%if (hasProjectMoreLink)
                              {  %>
                        </div>
                        <% }%>
                    </div>--%>

                    <% } %>
                </div>
            </fieldset>


            <% if (!String.IsNullOrEmpty(Request.QueryString["SearchCriteria"])) { %>
            <div class="facetdel">
                <%:Html.ActionLink("Zoekwoord : " + Request.QueryString["SearchCriteria"], "Index", "Search", new
                    {
                        SearchCriteria = "",
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"]
                    }, new { title = "Zoekwoord facet verwijderen" })%>
            </div>
            <% } %>


            <% if (!String.IsNullOrEmpty(Request.QueryString["typeAnaloog"]) || !String.IsNullOrEmpty(Request.QueryString["typeDigitaal"]) || !String.IsNullOrEmpty(Request.QueryString["typeVideoAnimation"]) || !String.IsNullOrEmpty(Request.QueryString["typeMapIllustration"]))
               {
                   String mediaTypeDescription = "";
                   if (!String.IsNullOrEmpty(Request.QueryString["typeAnaloog"]) && Request.QueryString["typeAnaloog"].Equals("True"))
                   {
                       mediaTypeDescription = "Analoge foto";
                   }

                   if (!String.IsNullOrEmpty(Request.QueryString["typeDigitaal"]) && Request.QueryString["typeDigitaal"].Equals("True"))
                   {
                       mediaTypeDescription = "Digitale foto";
                   }

                   if (!String.IsNullOrEmpty(Request.QueryString["typeVideoAnimation"]) && Request.QueryString["typeVideoAnimation"].Equals("True"))
                   {
                       mediaTypeDescription = "Video/Animatie";
                   }

                   if (!String.IsNullOrEmpty(Request.QueryString["typeMapIllustration"]) && Request.QueryString["typeMapIllustration"].Equals("True"))
                   {
                       mediaTypeDescription = "Kaart/Illustratie";
                   }                                                                     
                                         
            %>
            <div class="facetdel">
                <%:Html.ActionLink("MediaType : " + mediaTypeDescription, "Index", "Search", new
                {
                    SearchCriteria = "",
                    typeAnaloog = "",
                    typeDigitaal = "",
                    typeVideoAnimation = "",
                    typeMapIllustration = "",
                    onlyMyItems = Request.QueryString["onlyMyItems"],
                    OrderBy = Request.QueryString["OrderBy"],
                    fromDateCheck = Request.QueryString["fromDateCheck"],
                    fromDate = Request.QueryString["fromDate"],
                    toDateCheck = Request.QueryString["toDateCheck"],
                    toDate = Request.QueryString["toDate"],
                    displayMode = Request.QueryString["displayMode"],
                    collectionId = Request.QueryString["collectionId"],
                    statusId = Request.QueryString["statusId"],
                    showInternalItems = Request.QueryString["showInternalItems"],
                    RegioFacet = Request.QueryString["RegioFacet"],
                    TechniekFacet = Request.QueryString["TechniekFacet"],
                    RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                    ProjectFacet = Request.QueryString["ProjectFacet"]
                }, new { title = "MediaType facet verwijderen" })%>
            </div>
            <% } %>

            <% if (!String.IsNullOrEmpty(Request.QueryString["fromDate"]))
               {
                   int yearIndexDel = 1;
                   String selectedYearFacetName = "";
                   foreach (var YearFacet in Model.YearFacetsAll)
                   {
                       if (Request.QueryString["fromDate"].EndsWith(YearFacet.ToString()))
                       {
                           selectedYearFacetName = YearFacet.ToString();
                       }
                       yearIndexDel++;
                   }
            %>
            <div class="facetdel">
                <%:Html.ActionLink("Jaar : " + selectedYearFacetName, "Index", "Search", new
                {
                    SearchCriteria = Request.QueryString["SearchCriteria"],
                    typeAnaloog = Request.QueryString["typeAnaloog"],
                    typeDigitaal = Request.QueryString["typeDigitaal"],
                    typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                    typeMapIllustration = Request.QueryString["typeMapIllustration"],
                    onlyMyItems = Request.QueryString["onlyMyItems"],
                    OrderBy = Request.QueryString["OrderBy"],
                    fromDateCheck = Request.QueryString["fromDateCheck"],
                    fromDate = "",
                    toDateCheck = Request.QueryString["toDateCheck"],
                    toDate = "",
                    displayMode = Request.QueryString["displayMode"],
                    collectionId = Request.QueryString["collectionId"],
                    statusId = Request.QueryString["statusId"],
                    showInternalItems = Request.QueryString["showInternalItems"],
                    RegioFacet = Request.QueryString["RegioFacet"],
                    TechniekFacet = Request.QueryString["TechniekFacet"],
                    RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                    ProjectFacet = Request.QueryString["ProjectFacet"]
                }, new { title = "Jaar facet verwijderen" })%>
            </div>
            <% } %>

            <% if (!String.IsNullOrEmpty(Request.QueryString["collectionId"]))
               {
                   int themaIndexDel = 1;
                   String selectedThemaFacetName = "";
                   foreach (var ThemaFacet in Model.ThemaFacetsAll)
                   {
                       if (Request.QueryString["collectionId"].Equals(ThemaFacet.Id.ToString()))
                       {
                           selectedThemaFacetName = ThemaFacet.Name;
                       }
                       themaIndexDel++;
                   }
            %>
            <div class="facetdel">
                <%:Html.ActionLink("Thema : " + selectedThemaFacetName, "Index", "Search", new
                {
                    SearchCriteria = Request.QueryString["SearchCriteria"],
                    typeAnaloog = Request.QueryString["typeAnaloog"],
                    typeDigitaal = Request.QueryString["typeDigitaal"],
                    typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                    typeMapIllustration = Request.QueryString["typeMapIllustration"],
                    onlyMyItems = Request.QueryString["onlyMyItems"],
                    OrderBy = Request.QueryString["OrderBy"],
                    fromDateCheck = Request.QueryString["fromDateCheck"],
                    fromDate = Request.QueryString["fromDate"],
                    toDateCheck = Request.QueryString["toDateCheck"],
                    toDate = Request.QueryString["toDate"],
                    displayMode = Request.QueryString["displayMode"],
                    collectionId = "",
                    statusId = Request.QueryString["statusId"],
                    showInternalItems = Request.QueryString["showInternalItems"],
                    RegioFacet = Request.QueryString["RegioFacet"],
                    TechniekFacet = Request.QueryString["TechniekFacet"],
                    RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                    ProjectFacet = Request.QueryString["ProjectFacet"]
                }, new { title = "Thema facet verwijderen" })%>
            </div>
            <% } %>

            <% if (!String.IsNullOrEmpty(Request.QueryString["RegioFacet"]))
               {
                   int regioIndexDel = 1;
                   String selectedRegioFacetName = "";
                   foreach (var RegioFacet in Model.RegioFacetsAll)
                   {
                       if (Request.QueryString["RegioFacet"].Equals(RegioFacet.Id.ToString()))
                           selectedRegioFacetName = RegioFacet.Regio;

                       regioIndexDel++;
                   }
            %>
            <div class="facetdel">
                <%:Html.ActionLink("Regio : " + selectedRegioFacetName, "Index", "Search", new
                {
                    SearchCriteria = Request.QueryString["SearchCriteria"],
                    typeAnaloog = Request.QueryString["typeAnaloog"],
                    typeDigitaal = Request.QueryString["typeDigitaal"],
                    typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                    typeMapIllustration = Request.QueryString["typeMapIllustration"],
                    onlyMyItems = Request.QueryString["onlyMyItems"],
                    OrderBy = Request.QueryString["OrderBy"],
                    fromDateCheck = Request.QueryString["fromDateCheck"],
                    fromDate = Request.QueryString["fromDate"],
                    toDateCheck = Request.QueryString["toDateCheck"],
                    toDate = Request.QueryString["toDate"],
                    displayMode = Request.QueryString["displayMode"],
                    collectionId = Request.QueryString["collectionId"],
                    statusId = Request.QueryString["statusId"],
                    showInternalItems = Request.QueryString["showInternalItems"],
                    RegioFacet = "",
                    TechniekFacet = Request.QueryString["TechniekFacet"],
                    RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                    ProjectFacet = Request.QueryString["ProjectFacet"]
                }, new { title = "Regio facet verwijderen" })%>
            </div>
            <% } %>

            <% if (!String.IsNullOrEmpty(Request.QueryString["TechniekFacet"]))
               {
                   int techniekIndexDel = 1;
                   String selectedTechniekFacetName = "";
                   foreach (var TechniekFacet in Model.TechniekFacetsAll)
                   {
                       if (Request.QueryString["TechniekFacet"].Equals(TechniekFacet.Id.ToString()))
                           selectedTechniekFacetName = TechniekFacet.Techniek;

                       techniekIndexDel++;
                   }
            %>
            <div class="facetdel">
                <%:Html.ActionLink("Techniek : " + selectedTechniekFacetName, "Index", "Search", new
                    {
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = "",
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"]
                    }, new { title = "Techniek facet verwijderen" })%>
            </div>
            <% } %>

            <% if (!String.IsNullOrEmpty(Request.QueryString["RiviergebiedFacet"]))
               {
                   int rivierGebiedIndexDel = 1;
                   String selectedRivierGebiedFacetName = "";
                   foreach (var RivierGebiedFacet in Model.RivierGebiedFacetsAll)
                   {
                       if (Request.QueryString["RiviergebiedFacet"].Equals(RivierGebiedFacet.Id.ToString()))
                           selectedRivierGebiedFacetName = RivierGebiedFacet.Riviergebied;

                       rivierGebiedIndexDel++;
                   }
            %>
            <div class="facetdel">
                <%:Html.ActionLink("Riviergebied : " + selectedRivierGebiedFacetName, "Index", "Search", new
                {
                    SearchCriteria = Request.QueryString["SearchCriteria"],
                    typeAnaloog = Request.QueryString["typeAnaloog"],
                    typeDigitaal = Request.QueryString["typeDigitaal"],
                    typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                    typeMapIllustration = Request.QueryString["typeMapIllustration"],
                    onlyMyItems = Request.QueryString["onlyMyItems"],
                    OrderBy = Request.QueryString["OrderBy"],
                    fromDateCheck = Request.QueryString["fromDateCheck"],
                    fromDate = Request.QueryString["fromDate"],
                    toDateCheck = Request.QueryString["toDateCheck"],
                    toDate = Request.QueryString["toDate"],
                    displayMode = Request.QueryString["displayMode"],
                    collectionId = Request.QueryString["collectionId"],
                    statusId = Request.QueryString["statusId"],
                    showInternalItems = Request.QueryString["showInternalItems"],
                    RegioFacet = Request.QueryString["RegioFacet"],
                    TechniekFacet = Request.QueryString["TechniekFacet"],
                    RiviergebiedFacet = "",
                    ProjectFacet = Request.QueryString["ProjectFacet"]
                }, new { title = "Riviergebied facet verwijderen" })%>
            </div>
            <% } %>

            <% if (!String.IsNullOrEmpty(Request.QueryString["ProjectFacet"]))
               {
                   int projectIndexDel = 1;
                   String selectedProjectFacetName = "";
                   foreach (var ProjectFacet in Model.ProjectFacetsAll)
                   {
                       if (Request.QueryString["ProjectFacet"].Equals(ProjectFacet.Id.ToString()))
                           selectedProjectFacetName = ProjectFacet.Project;

                       projectIndexDel++;
                   }
            %>
            <div class="facetdel">
                <%:Html.ActionLink("Project : " + selectedProjectFacetName, "Index", "Search", new
                    {
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = ""
                    }, new { title = "Project facet verwijderen" })%>
            </div>
            <% } %>
            <div class="clear"></div>


            <div id="customMobileDisplayToggle">Toon weergaveopties</div>
            <div class="divshowing" id="customDisplayOptions">

                <div class="searchpagekolomfaceted">
                    <p>
                        <label for="OrderBy" class="displaynone">
                            Sorteren</label>
                        <select id="OrderBy" name="OrderBy">
                            <option <% if (Request.QueryString["OrderBy"] == null)
                                       {%>
                                selected="selected" <%}%> value="null">- Kies sortering -</option>
                            <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("3") == true)
                                       {%>
                                selected="selected" <%}%> value="3">Relevantie</option>
                            <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("1") == true)
                                       {%>
                                selected="selected" <%}%> value="1">Inventaris</option>
                            <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("5") == true)
                                       {%>
                                selected="selected" <%}%> value="5">Inventaris aflopend</option>
                            <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("2") == true)
                                       {%>
                                selected="selected" <%}%> value="2">Datum</option>
                            <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("6") == true)
                                       {%>
                                selected="selected" <%}%> value="6">Datum aflopend</option>
                            <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("7") == true)
                                       {%>
                                selected="selected" <%}%> value="7">Recent gewijzigd</option>
                            <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("8") == true)
                                       {%>
                                selected="selected" <%}%> value="8">Recent toegevoegd</option>
                        </select>&nbsp;<a name="HelpVideo7" href="/Miscellaneous/FAQ" title="Help" rel="#search2"><img class="help-icon" src="<%= AppHelper.getContent("~/Content/images/help.gif")%>" alt="Help icon" /></a>
                        <br />
                    </p>
                </div>

                <div class="paginas">
                    <p>
                        <%
                            int startPagingFrom = Convert.ToInt32(Request.QueryString["startPagingFrom"]);
                            int currentPage = Convert.ToInt32(Request.QueryString["page"]);

                            int imagesPerPage = 20;
                            if (Request.QueryString["displayMode"] != null)
                            {
                                switch (int.Parse(Request.QueryString["displayMode"]))
                                {
                                    case 1:
                                        imagesPerPage = 10;
                                        break;
                                    case 2:
                                        imagesPerPage = 20;
                                        break;
                                    case 3:
                                        imagesPerPage = 80;
                                        break;
                                }
                            }
                            int i = startPagingFrom;
                            int maxPages = 10 + startPagingFrom;

                            if (startPagingFrom >= 10)
                            {
                        %>
                        <%:Html.ActionLink("<<", "Index", "Search", new
{
                        startPagingFrom = startPagingFrom-10,
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>
                        <%
                            }

                            if (startPagingFrom >= 1)
                            {    
                        %>
                        <%:Html.ActionLink("<", "Index", "Search", new
                    {
                        startPagingFrom = startPagingFrom-1,
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>
                        <%             
                        }
                        while (Model.NumberOfResults > i * imagesPerPage && i < maxPages)
                        {
                        %>
                        <%:Html.ActionLink(i.ToString(), "Index", "Search", new
                    {
                        startPagingFrom = startPagingFrom, 
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>&nbsp;
                    <%
                            i++;
                        }
                    %>
                        <%
                            if (Model.NumberOfResults / imagesPerPage > currentPage)
                            { 
                        %>
                        <%:Html.ActionLink(">", "Index", "Search", new
                    {
                        startPagingFrom = startPagingFrom + 1,
                        page = currentPage + 1,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"] 
                    }, null)%>
                        <% } %>
                        <%
                            if (Model.NumberOfResults > i * imagesPerPage)
                            {        
                        %>
                        <%:Html.ActionLink(">>", "Index", "Search", new
                    {
                        startPagingFrom = startPagingFrom + 10,
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeAnaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        showInternalItems = Request.QueryString["showInternalItems"],
                        RegioFacet = Request.QueryString["RegioFacet"],
                        TechniekFacet = Request.QueryString["TechniekFacet"],
                        RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                        ProjectFacet = Request.QueryString["ProjectFacet"] 
                    }, null)%>
                        <% } %>
                    </p>
                </div>
                <div class="weergave">
                    <p>
                        <%
                            string listButton = "";
                            string galleryButton = "";
                            string gridButton = "";

                            listButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-list-off.gif") + "\" alt=\"Detail weergave\" />";
                            galleryButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-gallery-off.gif") + "\" alt=\"Overzicht weergave\"/>";
                            gridButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-grid-off.gif") + "\" alt=\"Lichtbak weergave\"/>";

                            if (Request.QueryString["displayMode"] != null)
                            {
                                switch (Request.QueryString["displayMode"])
                                {
                                    case "1":
                                        listButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-list-on.gif") + "\" alt=\"Detail weergave\" />";
                                        break;
                                    case "2":
                                        galleryButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-gallery-on.gif") + "\" alt=\"Overzicht weergave\" />";
                                        break;
                                    case "3":
                                        gridButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-grid-on.gif") + "\" alt=\"Lichtbak weergave\" />";
                                        break;
                                }
                            }
                            else
                            {
                                galleryButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-gallery-on.gif") + "\" alt=\"Overzicht weergave\" />";
                            }
                        %>
                        <% 
                            // todo: move this logic to the model
                            // compensation for amount of images per page
                            int startPagingFrom_ToType1 = 0;
                            int currentPage_ToType1 = 0;

                            int startPagingFrom_ToType2 = 0;
                            int currentPage_ToType2 = 0;

                            int startPagingFrom_ToType3 = 0;
                            int currentPage_ToType3 = 0;

                            if (Request.QueryString["displayMode"] != null)
                            {
                                switch (int.Parse(Request.QueryString["displayMode"]))
                                {
                                    case 1:
                                        startPagingFrom_ToType1 = startPagingFrom;
                                        currentPage_ToType1 = currentPage;

                                        startPagingFrom_ToType2 = startPagingFrom / 2;
                                        currentPage_ToType2 = currentPage / 2;

                                        startPagingFrom_ToType3 = startPagingFrom / 4;
                                        currentPage_ToType3 = currentPage / 4;
                                        break;
                                    case 2:
                                        startPagingFrom_ToType1 = startPagingFrom * 2;
                                        currentPage_ToType1 = currentPage * 2;

                                        startPagingFrom_ToType2 = startPagingFrom;
                                        currentPage_ToType2 = currentPage;

                                        startPagingFrom_ToType3 = startPagingFrom / 2;
                                        currentPage_ToType3 = currentPage / 2;
                                        break;
                                    case 3:
                                        startPagingFrom_ToType1 = startPagingFrom * 4;
                                        currentPage_ToType1 = currentPage * 4;

                                        startPagingFrom_ToType2 = startPagingFrom * 2;
                                        currentPage_ToType2 = currentPage * 2;

                                        startPagingFrom_ToType3 = startPagingFrom;
                                        currentPage_ToType3 = currentPage;
                                        break;
                                }
                            }
                        %>
                        <%=Html.ActionLink("_ph_", "Index", "Search", new
                        {
                            startPagingFrom = startPagingFrom_ToType1,
                            page = currentPage_ToType1,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = "1",
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null).ToString().Replace("_ph_", listButton)%>&nbsp;
                    <%=Html.ActionLink("_ph_", "Index", "Search", new
                        {
                            startPagingFrom = startPagingFrom_ToType2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = "2",
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null).ToString().Replace("_ph_", galleryButton)%>&nbsp;
                    <%=Html.ActionLink("_ph_", "Index", "Search", new
                        {
                            startPagingFrom = startPagingFrom_ToType3,
                            page = currentPage_ToType3,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = "3",
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null).ToString().Replace("_ph_", gridButton)%>&nbsp;
                    </p>
                </div>
            </div>


        </form>

        <%
            int width = 150;
            int cellWidth = 165;
            int fotosPerRegel = 4;

            if (Request.QueryString["displayMode"] != null)
            {
                switch (int.Parse(Request.QueryString["displayMode"]))
                {
                    case 1:
                        width = 188;
                        fotosPerRegel = 1;
                        cellWidth = 663;
                        break;
                    case 2:
                        width = 150;
                        fotosPerRegel = 4;
                        cellWidth = 165;
                        break;
                    case 3:
                        width = 65;
                        fotosPerRegel = 8;
                        cellWidth = 84;
                        break;
                }
            }
        %>
        <% 
            int index = 0;
            foreach (BEELDBANK_MEDIAOBJECT mediaobject in Model.mediaobjects)
            {
        %>
        <% 
                if (Request.QueryString["displayMode"] != null && int.Parse(Request.QueryString["displayMode"]) == 1)
                {
        %>
        <div class="lijstlinks">
            <div class="lijstlinks">
                <%=Url.Image<HomeController>(c => c.DisplayThumb(mediaobject.Id.ToString()), width, AppHelper.convertHtmlStringToAltTag(mediaobject), AppHelper.convertHtmlStringToAltTag(mediaobject), AppHelper.getContent("~/MediaObject/Details/" + AppHelper.convertToUrlTitle(mediaobject.Omschrijving, mediaobject.Id) + "?resultType=" + TempData["resultIdType"] + "&resultList=" + TempData["resultIdList"]))%>
                <%--=Url.Image<HomeController>(c => c.DisplayThumb(mediaobject.Id.ToString()), width, mediaobject.Omschrijving, mediaobject.Omschrijving, "/MediaObject/Details/" + mediaobject.Id)--%>
            </div>
            <div class="lijstweergave">
                <div class="listdata">
                    <% if ((Roles.IsUserInRole("Administrator")) || ((mediaobject.GroepRechten != null) && Roles.IsUserInRole(mediaobject.GroepRechten)) || (mediaobject.modifiedby.ToLower() == Model.currentUserName.ToLower()) || (mediaobject.createdby.ToLower() == Model.currentUserName.ToLower()))
                       { %>
                    <%--<br />--%>
                    <a href="<%= Url.Action("Edit", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id })) %>">
                        <img src="<%=AppHelper.getContent("~/Content/images/edit.gif") %>" title="Wijzig mediaobject" alt="Wijzig mediaobject" /></a>&nbsp;&nbsp;
                            <a href="<%= Url.Action("Delete", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id })) %>">
                                <img src="<%=AppHelper.getContent("~/Content/images/delete.gif") %>" title="Verwijder mediaobject" alt="Verwijder mediaobject" onclick="javascript:return confirm('Dit media object zal permanent worden verwijderd, weet u het zeker?');" /></a>
                    <% } %>
                </div>
                <div class="lijsttitel">
                    <strong>Inventaris nr.</strong>
                </div>
                <div class="lijstdata">
                    <%: mediaobject.Titel%>
                </div>
                <div class="lijsttitel">
                    <strong>Omschrijving</strong>
                </div>
                <div class="lijstdata">
                    <%= mediaobject.Omschrijving%>
                </div>
                <div class="lijsttitel">
                    <strong>Trefwoorden</strong>
                </div>
                <div class="lijstdata">
                    <%: mediaobject.Trefwoorden%>
                </div>
                <div class="lijsttitel">
                    <strong>Datum</strong>
                </div>
                <div class="lijstdata">
                    <%: String.Format("{0:d}", mediaobject.Datum_Realisatie)%>
                </div>
            </div>
        </div>
        <%
                }
                else
                {
        %>
        <% if (index == 0)
           {%>
        <div class="weergavefoto">
            <% } %>
            <% else if (index % fotosPerRegel == 0)
           { %>
        </div>
        <div class="weergavefoto">
            <% } %>
            <div class="weergavefoto">
                <%=Url.Image<HomeController>(c => c.DisplayThumb(mediaobject.Id.ToString()), width, AppHelper.convertHtmlStringToAltTag(mediaobject), AppHelper.convertHtmlStringToAltTag(mediaobject), AppHelper.getContent("~/MediaObject/Details/" + AppHelper.convertToUrlTitle(mediaobject.Omschrijving, mediaobject.Id) + "?resultType=" + TempData["resultIdType"] + "&resultList=" + TempData["resultIdList"]))%>
                <% 
           // only display title for viewmode2
           if ((Request.QueryString["displayMode"] != null && int.Parse(Request.QueryString["displayMode"]) == 2) || Request.QueryString["displayMode"] == null)
           { %>
                <div>
                    <%: Html.ActionLink(Beeldbankmvc.Helpers.Tools.getMaxLengthVersion(mediaobject.Titel, 20), "Details", "MediaObject", new { id = AppHelper.convertToUrlTitle(mediaobject.Omschrijving, mediaobject.Id) }, null)%>
                    &nbsp;
                    <% if ((Roles.IsUserInRole("Administrator")) || ((mediaobject.GroepRechten != null) && Roles.IsUserInRole(mediaobject.GroepRechten)) || (mediaobject.modifiedby.ToLower() == Model.currentUserName.ToLower()) || (mediaobject.createdby.ToLower() == Model.currentUserName.ToLower()))
                       { %>
                    <br />
                    <a href="<%= Url.Action("Edit", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id,  resultType = TempData["resultIdType"], resultList = TempData["resultIdList"]})) %>">
                        <img src="<%=AppHelper.getContent("~/Content/images/edit.gif") %>" title="Wijzig mediaobject" alt="Wijzig mediaobject" /></a>&nbsp;&nbsp;
                    <a href="<%= Url.Action("Delete", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id })) %>">
                        <img src="<%=AppHelper.getContent("~/Content/images/delete.gif") %>" title="Verwijder mediaobject" alt="Verwijder mediaobject" onclick="javascript:return confirm('Dit media object zal permanent worden verwijderd, weet u het zeker?');" /></a>
                    <% } %>
                </div>
                <% } %>
            </div>
            <% } %>
            <% 
                index++;
            } %>
            <% 
                if (Request.QueryString["displayMode"] != "1" && Model.NumberOfResults != 0)
                {
            %>
        </div>
        <% } %>
        <div class="divshowing">
            <div class="paginas">
                <p>
                    <%
                        int startPaging2From = Convert.ToInt32(Request.QueryString["startPagingFrom"]);
                        int current2Page = Convert.ToInt32(Request.QueryString["page"]);

                        int images2PerPage = 20;
                        if (Request.QueryString["displayMode"] != null)
                        {
                            switch (int.Parse(Request.QueryString["displayMode"]))
                            {
                                case 1:
                                    images2PerPage = 10;
                                    break;
                                case 2:
                                    images2PerPage = 20;
                                    break;
                                case 3:
                                    images2PerPage = 80;
                                    break;
                            }
                        }
                        int i2 = startPaging2From;
                        int max2Pages = 10 + startPaging2From;

                        if (startPaging2From >= 10)
                        {
                    %>
                    <%:Html.ActionLink("<<", "Index", "Search", new
                        {
                            startPagingFrom = startPaging2From-10,
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>
                    <%
                        }

                        if (startPaging2From >= 1)
                        {    
                    %>
                    <%:Html.ActionLink("<", "Index", "Search", new
                        {
                            startPagingFrom = startPaging2From-1,
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>
                    <%             
                        }
                        while (Model.NumberOfResults > i2 * images2PerPage && i2 < maxPages)
                        {
                    %>
                    <%:Html.ActionLink(i2.ToString(), "Index", "Search", new
                        {
                            startPagingFrom = startPaging2From, 
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>&nbsp;
                    <%
                            i2++;
                        }
                    %>
                    <%
                        if (Model.NumberOfResults / images2PerPage > currentPage)
                        { 
                    %>
                    <%:Html.ActionLink(">", "Index", "Search", new
                        {
                            startPagingFrom = startPaging2From + 1,
                            page = currentPage + 1,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>
                    <% } %>
                    <%
                        if (Model.NumberOfResults > i2 * images2PerPage)
                        {        
                    %>
                    <%:Html.ActionLink(">>", "Index", "Search", new
                        {
                            startPagingFrom = startPaging2From + 10,
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeAnaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            showInternalItems = Request.QueryString["showInternalItems"],
                            RegioFacet = Request.QueryString["RegioFacet"],
                            TechniekFacet = Request.QueryString["TechniekFacet"],
                            RiviergebiedFacet = Request.QueryString["RiviergebiedFacet"],
                            ProjectFacet = Request.QueryString["ProjectFacet"] 
                        }, null)%>
                    <% } %>
                </p>
            </div>
        </div>
    </div>
    <!-- Last cached: <%: DateTime.Now %> -->

    <%-- Help videos worden op dit moment niet gebruikt; help iconen verwijzen naar faq pagina --%>
    <%--<!-- overlays -->
    <div class="simple_overlay" id="search1">
        <!-- description for the movie (optional) -->
        <div id="mediaplayer6" class="content_overlay">
        </div>
        <!-- dynamic insertion of mediaplayer for this mediaobject -->
        <script type='text/javascript'>
            jwplayer('mediaplayer6').setup({
                //'image': 'https://beeldbank.rws.nl/AppData/help/Fotozoek-01.jpg',
                'image': 'http://rws-beeldarchief/AppData/help/Fotozoek-01.jpg',
                'controlbar': 'bottom', 'width': '640', 'height': '367',
                levels: [
                    { file: "https://beeldbank.rws.nl/AppData/help/Fotozoek-01.mp4" },
                    { file: "https://beeldbank.rws.nl/AppData/help/Fotozoek-01.flv" },
                    { file: "https://beeldbank.rws.nl/AppData/help/Fotozoek-01.3gp" }
                    //{ file: "http://rws-beeldarchief/AppData/help/Fotozoek-01.mp4" },
                    //{ file: "http://rws-beeldarchief/AppData/help/Fotozoek-01.flv" },
                    //{ file: "http://rws-beeldarchief/AppData/help/Fotozoek-01.3gp" }
                ],
                modes: [
                    { type: "flash", src: "<%= AppHelper.getContent("~/Content/flash/player.swf")%>" },
                    { type: "html5" },
                    { type: "download" }
                ]
            });
        </script>
    </div>
    <div class="simple_overlay" id="search2">
        <!-- description for the movie (optional) -->
        <div id="mediaplayer7" class="content_overlay">
        </div>
        <!-- dynamic insertion of mediaplayer for this mediaobject -->
        <script type='text/javascript'>
            jwplayer('mediaplayer7').setup({
                //'image': 'https://beeldbank.rws.nl/AppData/help/Fotozoek-02.jpg',
                'image': 'http://rws-beeldarchief/AppData/help/Fotozoek-02.jpg',
                'controlbar': 'bottom', 'width': '640', 'height': '480',
                levels: [
                    { file: "https://beeldbank.rws.nl/AppData/help/Fotozoek-02.mp4" },
                    { file: "https://beeldbank.rws.nl/AppData/help/Fotozoek-02.flv" },
                    { file: "https://beeldbank.rws.nl/AppData/help/Fotozoek-02.3gp" }
                    //{ file: "http://rws-beeldarchief/AppData/help/Fotozoek-02.mp4" },
                    //{ file: "http://rws-beeldarchief/AppData/help/Fotozoek-02.flv" },
                    //{ file: "http://rws-beeldarchief/AppData/help/Fotozoek-02.3gp" }
                ],
                modes: [
                    { type: "flash", src: "<%= AppHelper.getContent("~/Content/flash/player.swf")%>" },
                    { type: "html5" },
                    { type: "download" }
                ]
            });
        </script>
    </div>--%>

    <%--<script type="text/javascript">
        $(document).ready(function () {
            $("a[rel]").overlay();
        });
    </script>--%>
    
    <% Html.RenderPartial("Share"); %>
</asp:Content>
